//
//  SceneIconCell.m
//  YSSmartHome
//
//  Created by yanghao on 16/9/12.
//  Copyright © 2016年 yahaong. All rights reserved.
//

#import "SceneIconCell.h"
#import "YHMarcros.h"

@interface SceneIconCell ()


@end
@implementation SceneIconCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.iconBtn];
        [self.iconBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(self.contentView);
            make.size.equalTo(CGSizeMake(kIphoneSize_Widith(75), kIphoneSize_Widith(75)));
        }];
    }
    return self;
}


- (void)setIcon:(SceneIconModel *)icon
{
    _icon = icon;
    [self.iconBtn setImage:[UIImage imageNamed:icon.icon] forState:UIControlStateNormal];
    [self.iconBtn setImage:[UIImage imageNamed:icon.selectIcon] forState:UIControlStateSelected];
    
}

#pragma mark  - lazy loading
- (UIButton *)iconBtn
{
    if (!_iconBtn) {
        _iconBtn = [[UIButton alloc]init];
        _iconBtn.userInteractionEnabled = NO;
    }
    return _iconBtn;
}


@end
